<x-app-layout>
    <x-slot name="header">
        <h2 class="font-semibold text-xl text-gray-800 leading-tight">
            {{ __('categories') }}
        </h2>
    </x-slot>
   <div>
   <ul>
    @foreach($categories as $category)
        <li>{{ $category->name }}
            @if($category->children)
                <ul>
                    @foreach($category->children as $child)
                        @include('categories.subcategory', ['category' => $child])
                    @endforeach
                </ul>
            @endif
        </li>
    @endforeach
</ul>
   </div>
</x-app-layout>